package com.bdqn.proxy;
//import com.bdqn.service.impl.RealBuyer;
import net.sf.cglib.proxy.Enhancer;
import org.apache.log4j.Logger;
import org.junit.Test;

/**
 * 第三章示例9
 */
/*public class IntermediaryCglibProxyFactory {
    private Logger logger=Logger.getLogger(IntermediaryCglibProxyFactory.class);
    private static IntermediaryMethodInterceptor callback = new IntermediaryMethodInterceptor();
    public static <T> T create(Class<T> target){
        Enhancer enhancer=new Enhancer();
        enhancer.setCallback(callback);
        enhancer.setSuperclass(target);
        return (T) enhancer.create();
    }
    @Test
    public void havealookCglibProxy() throws Exception{
        RealBuyer buyer=IntermediaryCglibProxyFactory.create(RealBuyer.class);
        String result=buyer.havealook();
        logger.debug(result);
    }
}*/
